﻿<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.vb" Inherits="WSADProject._Default" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <p>
        
        Welcome to my Fishing in Grenada Website.... I hope you will enjoy your stay at my website.</p>
   
       <div> 
        <table style="width:100%;">
            <tr>
                <td style="text-align: center" class="auto-style2">
                   <h2> <span class="auto-style3">List of Users</span></h2>
                    <asp:GridView ID="GridView2" runat="server" BorderStyle="Solid" BorderWidth ="1px" BorderColor ="WhiteSmoke" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="680px">
                        <Columns>
                           

        

                            <asp:TemplateField HeaderText="Username">

            <EditItemTemplate>

                <asp:TextBox ID="TextBox1" runat="server" Text='<%# 
Bind("UserName") %>'></asp:TextBox>

            </EditItemTemplate>

            <ItemTemplate>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ='<%# String.Format("details.aspx?id={0}", Eval("UserID"))%>'><%# Eval("Username") %>  </asp:HyperLink>
       </ItemTemplate>

                                <HeaderStyle CssClass="hdtxt" />

        </asp:TemplateField>
<asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" >
                            <HeaderStyle CssClass="hdtxt" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" >
                            <HeaderStyle CssClass="hdtxt" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" >
                            <HeaderStyle CssClass="hdtxt" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LastActivityDate" DataFormatString="{0:d}" HeaderText="LastActivityDate" SortExpression="LastActivityDate" >
                            <HeaderStyle CssClass="hdtxt" />
                            </asp:BoundField>
                        </Columns>
                    </asp:GridView>
                    
                    
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:fishconn %>" ProviderName="<%$ ConnectionStrings:fishconn.ProviderName %>" SelectCommand="SELECT top 3 tblProfile.UserName, tblProfile.ProfilePicturesmall, tblProfile.UserID, tblProfile.FirstName, tblProfile.LastName, tblProfile.Country, aspnet_Users.LastActivityDate FROM (aspnet_Users INNER JOIN tblProfile ON aspnet_Users.UserName = tblProfile.UserName) order by aspnet_Users.LastActivityDate desc"></asp:SqlDataSource>
                </td>
                <td><h2><span class="auto-style3">Statistics</span> </h2><asp:GridView ID="GridView3" runat="server" BorderStyle="Solid" BorderWidth ="1" BorderColor ="WhiteSmoke" AutoGenerateColumns="False" DataSourceID="SqlDataSource3" Width="316px">
                  <Columns>
                      <asp:BoundField DataField="descript" SortExpression="descript" />
                      <asp:BoundField DataField="cant" SortExpression="cant" />
                  </Columns>
                    </asp:GridView> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:fishconn %>" ProviderName="<%$ ConnectionStrings:fishconn.ProviderName %>" SelectCommand="(SELECT 'Profiles' as descript,count(tblProfile.UserID) as cant
FROM tblProfile)
union

(SELECT 'Discussions' as descript, count(tblDiscussion.DiscussionID) as cant
FROM tblDiscussion)

union

(SELECT 'Photos' as descript, count(tblPhoto.PhotoID) as cant
FROM tblPhoto where ACTV = 'A')

union

(SELECT 'Photo Comments' as descript, count(tblPhotoComments.PhotoCommentID) as cant
FROM tblPhotoComments)"></asp:SqlDataSource>
                     </td>
            </tr>
            <tr>
                <td class="auto-style1" colspan ="2">
                  <div><h2> <span class="auto-style3">Discussions</span></h2> </div> 
              <asp:GridView ID="GridView1" BorderStyle="Solid" BorderWidth ="1px" BorderColor ="WhiteSmoke" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" Width="800px">
                    <Columns>
                        <asp:TemplateField HeaderText="Topic" SortExpression="DiscussionSubject">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DiscussionSubject") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                               <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ='<%# String.Format("~/Discussreply.aspx?DiscusID={0}", Eval("DiscussionID"))%>' ><%# Eval("DiscussionSubject") %> </asp:HyperLink>
                            </ItemTemplate>
                            <HeaderStyle ForeColor="White" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="Username" HeaderText="Created By" SortExpression="Username" >
                        <HeaderStyle ForeColor="White" />
                        </asp:BoundField>
                        <asp:BoundField DataField="cant" HeaderText="Replies" SortExpression="cant" >
                        <HeaderStyle ForeColor="White" />
                        </asp:BoundField>
                    </Columns>
                    </asp:GridView>      
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:fishconn %>" ProviderName="<%$ ConnectionStrings:fishconn.ProviderName %>" SelectCommand="SELECT TOP 5 tblDiscussion.DiscussionID,tblDiscussion.DiscussionSubject, tblDiscussion.Username, COUNT(TblDiscusThread.DissusionID) AS cant FROM (tblDiscussion LEFT OUTER JOIN TblDiscusThread ON tblDiscussion.DiscussionID = TblDiscusThread.DissusionID) GROUP BY tblDiscussion.Username, tblDiscussion.DiscussionID, tblDiscussion.DiscussionSubject, tblDiscussion.CreatedDate, tblDiscussion.CreatedTime ORDER BY tblDiscussion.CreatedDate DESC, tblDiscussion.CreatedTime DESC"></asp:SqlDataSource>
              
                    &nbsp;</td>
              </tr> 
        </table>
  </div>
    <p>
&nbsp;</p>
    <p>
        &nbsp;</p>
</asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="HeadContent">
    <style type="text/css">
        .auto-style1 {
            width: 424px;
        }
        .auto-style2 {
            width: 583px;
        }
        .auto-style3 {
            color: #FFFFFF;
        }
    </style>
</asp:Content>

